package org.potiorb.demo.generated;

import java.util.List;

import org.potiorb.orb.ORBImpl;
import org.potiorb.orb.giop.GIOPMessageReply;
import org.potiorb.orb.giop.GIOPMessageRequest;
import org.potiorb.orb.giop.GIOPMessageRequestReflexive;
import org.potiorb.orb.invoke.Invoker;
import org.potiorb.orb.marshal.Any;
import org.potiorb.orb.marshal.CallData;
import org.potiorb.orb.marshal.MarshalerReflexive;
import org.potiorb.orb.marshal.ParamData;
import org.potiorb.orb.marshal.ParamMode;
import org.potiorb.orb.marshal.TCKind;
import org.potiorb.orb.marshal.TypeCodeImpl;
import org.potiorb.orb.portable.ObjectRef;

public class _TesteStubReflexive extends _TesteStub implements TesteReflexive{

	@Override
	public List<Object> executeBefore(String firstMethod, String secondMethod,
			String objectReferenceFirst, String objectReferenceSecond, List<Object> firstMethodParams, List<Object> secondMethodParams) {
				
	
		try {
		
		ObjectRef _ref = (ObjectRef)this._get_delegate();

		ParamData _paramslist[] = new ParamData[6];
		ParamData _param = new ParamData();
		_param.setParamMode(new ParamMode(ParamMode._pm_IN));
		_param.setTypeCode(new TypeCodeImpl(TCKind.tk_string));
		
		ParamData _param2 = new ParamData();
		_param2.setParamMode(new ParamMode(ParamMode._pm_IN));
		_param2.setTypeCode(new TypeCodeImpl(TCKind.tk_string));
		
		ParamData _param3 = new ParamData();
		_param2.setParamMode(new ParamMode(ParamMode._pm_IN));
		_param2.setTypeCode(new TypeCodeImpl(TCKind.tk_string));
		
		ParamData _param4 = new ParamData();
		_param2.setParamMode(new ParamMode(ParamMode._pm_IN));
		_param2.setTypeCode(new TypeCodeImpl(TCKind.tk_string));
		
		ParamData _param5 = new ParamData();
		_param2.setParamMode(new ParamMode(ParamMode._pm_IN));
		_param2.setTypeCode(new TypeCodeImpl(TCKind.tk_array));
		
		ParamData _param6 = new ParamData();
		_param2.setParamMode(new ParamMode(ParamMode._pm_IN));
		_param2.setTypeCode(new TypeCodeImpl(TCKind.tk_array));
		
		_paramslist[0] =_param;
		_paramslist[1] =_param2;
		_paramslist[2] =_param3;
		_paramslist[3] =_param4;
		_paramslist[4] =_param5;
		_paramslist[5] =_param6;
		
		CallData _call = new CallData();
		_call.setMethodName("executeBefore");
		_call.setNoOfParameters(6);
		_call.setParamerers(_paramslist);
		
		Any any1 = new Any();
		any1.insert_string(firstMethod);
		
		Any any2 = new Any();
		any2.insert_string(secondMethod);
		
		Any any3 = new Any();
		any3.insert_string(objectReferenceFirst);
		
		Any any4 = new Any();
		any4.insert_string(objectReferenceSecond);
		
		Any any5 = new Any();
		any5.insert_array(firstMethodParams);
		
		Any any6 = new Any();
		any6.insert_array(secondMethodParams);
		
		Any [] anys = new Any[]{any1,any2,any3,any4,any5,any6};
						
	    ORBImpl _orb = _ref.getOrb();
        MarshalerReflexive mar =  (MarshalerReflexive) _orb.getMarshaler();
        GIOPMessageRequestReflexive message = mar.MarshalInvocationRequest(_ref,_call, anys);
        Invoker inv = _orb.getInvoker();
        GIOPMessageReply _replymsg = inv.Invoke(message,_ref);
        _ref.getOrb().getMarshaler().UnmarshalInvocationReply(_replymsg);
		
			
		}
		catch(Exception e){
			e.printStackTrace();
		}
		
		
		return null;
	}

	@Override
	public List<Object> executeAfter(String firstMethod, String secondMethod,
			String objectReference, String objectReferenceSecond) {
		return null;
	}
	
	 
	
}
